<!DOCTYPE html>
<html>
<head>
    <title>海康威视首页</title>
</head>
<body>
<form id="visionMessage">
    <label>IP</label><input id="ip" name="ip" value="192.168.0.249"/>
    <label>端口号</label><input name="port" value="8000"/>
    <label>账号</label><input name="account" value="admin"/>
    <label>密码</label><input type="password" name="password" value=""/>
    <input type="button" onclick="submitVisionMessage()" value="布防"/>
</form>
<button onclick="closeAlarm()">撤防</button>
</body>
<script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
<script>

    function submitVisionMessage() {
        $.ajax({
            url: "hikvision/arming",
            type: "POST",
            data: $("#visionMessage").serialize(),
            success: function (res) {
                alert(res.message)
            },
            error: function (error) {
                console.log("error" + error)
            }
        })
    }

    function closeAlarm() {
        $.ajax({
            url: "hikvision/closeAlarm",
            type: "GET",
            data: {ip: $("#ip").val()},
            success: function (res) {
                alert(res.message)
            }
        })
    }

</script>
</html>